<?php 
	class m_category extends spModel
	{
	  public $pk = "id"; // 
	  public $table = "category"; // 数据表的名称
	  var $linker = array(
		'cat_article'=>array(
					'type' => 'hasmany',   // 一对多关联
					'map' => 'cat_article',    // 关联的标识
					'mapkey' => 'id', 
					'fclass' => 'm_article',
					'fkey' => 'cat_id',
					'sort' => 'weight DESC,add_time DESC',
					'field' => 'id,title,view_num,add_time,visible,weight',
					'condition'=> 'visible=1',
					'enabled' => false,
				),
		'cat_picture'=>array(
					'type' => 'hasmany',   // 一对多关联
					'map' => 'cat_picture',    // 关联的标识
					'mapkey' => 'id', 
					'fclass' => 'm_picture',
					'fkey' => 'cat_id',
					'sort' => 'weight DESC,add_time DESC',
					'field' => 'id,title,dir,view_num,add_time,visible,weight,height',
					'condition'=> 'visible=1',
					'enabled' => false,
				),
		'cat_page'=>array(
					'type' => 'hasone',   // 一对多关联
					'map' => 'cat_page',    // 关联的标识
					'mapkey' => 'id', 
					'fclass' => 'm_page',
					'fkey' => 'cat_id',
					'field' => 'id,cat_id,content,view_num,add_time,visible',
					'condition'=> '',
					'enabled' => false,
				),
		'cat_url'=>array(
					'type' => 'hasmany',   // 一对多关联
					'map' => 'cat_url',    // 关联的标识
					'mapkey' => 'id', 
					'fclass' => 'm_url',
					'fkey' => 'cat_id',
					'sort' => 'weight DESC,add_time DESC',
					'field' => 'id,title,content,description,view_num,img_dir,add_time,visible',
					'condition'=> 'visible=1',
					'enabled' => false,
				),
		'cat_url_first'=>array(
					'type' => 'hasone',   // 一对多关联
					'map' => 'cat_url_first',    // 关联的标识
					'mapkey' => 'id', 
					'fclass' => 'm_url',
					'fkey' => 'cat_id',
					'sort' => 'weight DESC,add_time DESC',
					'field' => 'id',
					'condition'=> 'visible=1',
					'enabled' => false,
				),
		'cat_son_count'=>array(
					'type' => 'hasmany',   // 一对多关联
					'map' => 'cat_son_count',    // 关联的标识
					'mapkey' => 'id',
					'fclass' => 'm_category',
					'fkey' => 'father_id',
					'countonly' => true,
					'enabled' => false,
				),

	  );	  
	}
?>